#include "gbUsb/gbIUsb.h"

#include "glib.h"

G_DEFINE_INTERFACE(GBIUsb, gb_iusb, G_TYPE_INVALID);

/*
static void gb_iusb_default_init(GBIUsbInterface *klass);

GType gb_iusb_get_type(void) {
    static GType static_g_define_type_id = 0;
    if ((__extension__({
            _Static_assert(sizeof *(&static_g_define_type_id) == sizeof(gpointer), "Expression evaluates to false");
            (void)(0 ? (gpointer) * (&static_g_define_type_id) : ((void *)0));
            (!(__extension__({
                _Static_assert(sizeof *(&static_g_define_type_id) == sizeof(gpointer), "Expression evaluates to false");
                __typeof__(*(&static_g_define_type_id)) gapg_temp_newval;
                __typeof__((&static_g_define_type_id))  gapg_temp_atomic = (&static_g_define_type_id);
                __atomic_load(gapg_temp_atomic, &gapg_temp_newval, 5);
                gapg_temp_newval;
            }))
             && g_once_init_enter_pointer(&static_g_define_type_id));
        }))) {
        GType g_define_type_id = g_type_register_static_simple(((GType)((2) << (2))),
                                                               g_intern_static_string("GBIUsb"),
                                                               sizeof(GBIUsbInterface),
                                                               (GClassInitFunc)(void (*)(void))gb_iusb_default_init,
                                                               0,
                                                               (GInstanceInitFunc)((void *)0),
                                                               (GTypeFlags)0);
        if (((GType)((0) << (2))) != ((GType)((0) << (2))))
            g_type_interface_add_prerequisite(g_define_type_id, ((GType)((0) << (2))));
        {{;
        ;
    }
}

(__extension__({
    _Static_assert(sizeof *(&static_g_define_type_id) == sizeof(gpointer), "Expression evaluates to false");
    0 ? (void)(*(&static_g_define_type_id) = (g_define_type_id)) : (void)0;
    g_once_init_leave_pointer((&static_g_define_type_id), (gpointer)(guintptr)(g_define_type_id));
}));
}
return static_g_define_type_id;
}
;
*/

static void gb_iusb_default_init(GBIUsbInterface *iface) {
}

gchar *gb_iusb_read(GBIUsb *self) {
    g_return_val_if_fail(GB_IS_IUSB(self), NULL);
    return GB_IUSB_GET_INTERFACE(self)->read(self);
}

void gb_iusb_write(GBIUsb *self, const gchar *str) {
    g_return_if_fail(GB_IS_IUSB(self));
    GB_IUSB_GET_INTERFACE(self)->write(self, str);
}
